<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <button onclick="handleClick()">买肉</button>
</body>
<script>
    function handleClick() {
        let result = buy("宋庭一","牛肉",function() {
            console.log("宋庭一买回了牛肉，坐着等着吃火锅")
        });
        
    }

    function buy(name,food,fun) {
        setTimeout(function() {
            console.log(`${name}去买${food}`);
            fun();
        },1000);
    }

</script>
</html>